/**
 * @Copyright:Copyright (c) 2007 - 2023
 * 
 */
package com.tengtong.duang.app.query.core;

import com.tengtong.commons.lang.StringUtils;

/**
 * 异常
 *
 * @author lin_jinming
 * @since: v1.0
 */
public class ExpressParseException extends RuntimeException{

    private static final long serialVersionUID = 1L;

    /**
     * 
     */
    public ExpressParseException() {
        super();
        
    }

    /**
     * @param message
     * @param cause
     * @param enableSuppression
     * @param writableStackTrace
     */
    public ExpressParseException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        
    }

    /**
     * @param message
     * @param cause
     */
    public ExpressParseException(String message, Throwable cause) {
        super(message, cause);
        
    }

    /**
     * @param message
     */
    public ExpressParseException(String message) {
        super(message);
        
    }

    /**
     * @param cause
     */
    public ExpressParseException(Throwable cause) {
        super(cause);
        
    }

    /**
     * 创建异常，其中所带的占位符为 %s
     *
     * @param message
     * @param objects
     * @return
     */
    public static ExpressParseException of(String message, Object...objects) {
        String msg = StringUtils.sprintf(message, objects);
        
        return new ExpressParseException(msg);
    }
    
    /**
     * 创建异常，其中所带的占位符为 %s
     *
     * @param message
     * @param objects
     * @return
     */
    public static ExpressParseException of(Throwable e, String message, Object...objects) {
        String msg = StringUtils.sprintf(message, objects);
        
        return new ExpressParseException(msg, e);
    }
    
}
